package com.lingyue.commons.enums;

/**
 * Created by IntelliJ IDEA.
 *
 * @Description: TODO
 * @Author: BaiJinhua
 * @Date: 2020-02-29 17:28
 * @See: com.lingyue.commons.enums
 * @Version: 1.0
 * Copyright: Copyright (c) 2019
 */
public enum GenderEnum implements CommEnum<String> {

    MALE("M","男"),
    FEMALE("F","女")
    ;

    private String code;
    private String content;

    GenderEnum(String code, String content){
        this.code = code;
        this.content = content;
    }


    public static String getContent(String code) {
        for (GenderEnum item : values()) {
            if (item.getCode().equals(code)) {
                return item.getContent();
            }
        }
        return code;
    }

    public static String getCode(String content) {
        for (GenderEnum item : values()) {
            if (item.getContent().equals(content)) {
                return item.getCode();
            }
        }
        return content;
    }

    @Override
    public String getCode() {
        return this.code;
    }

    @Override
    public String getContent() {
        return this.content;
    }
}
